package org.hysoft.spiderclient;

import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.*;

/**
 * Created by cl on 16/6/11.
 */
public class HshaClient {
    public static void main(String[] args)
    {
        TTransport tTransport=null;
        try{
            tTransport=new TFramedTransport(new TSocket("localhost",8092,300));
            tTransport.open();
            TProtocol tProtocol=new TCompactProtocol(tTransport);
            Spider.Client client=new Spider.Client(tProtocol);
            for (int i=0;i<10000;i++)
            {
                client.spiderPush("hello"+i);
                System.out.println(i);
                Thread.sleep(1);
            }

        }
        catch (TTransportException e)
        {
            e.printStackTrace();
        } catch (TException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {

            e.printStackTrace();
            if(null!=tTransport){
                tTransport.close();
            }
        }

    }
}
